import 'package:du_application/model/IndexModel.dart';

class SelectModel {
  int errno;
  Data data;
  String errmsg;

  SelectModel({this.errno, this.data, this.errmsg});

  SelectModel.fromJson(Map<String, dynamic> json) {
    errno = json['errno'];
    data = json['data'] != null ? new Data.fromJson(json['data']) : null;
    errmsg = json['errmsg'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['errno'] = this.errno;
    if (this.data != null) {
      data['data'] = this.data.toJson();
    }
    data['errmsg'] = this.errmsg;
    return data;
  }
}

class Data {
  int total;
  int pages;
  Cannnel cannnel;
  List<GoodsList> goodsList;
  int limit;
  int page;

  Data(
      {this.total,
      this.pages,
      this.cannnel,
      this.goodsList,
      this.limit,
      this.page});

  Data.fromJson(Map<String, dynamic> json) {
    total = json['total'];
    pages = json['pages'];
    cannnel =
        json['cannnel'] != null ? new Cannnel.fromJson(json['cannnel']) : null;
    if (json['goodsList'] != null) {
      goodsList = new List<GoodsList>();
      json['goodsList'].forEach((v) {
        goodsList.add(new GoodsList.fromJson(v));
      });
    }
    limit = json['limit'];
    page = json['page'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['total'] = this.total;
    data['pages'] = this.pages;
    if (this.cannnel != null) {
      data['cannnel'] = this.cannnel.toJson();
    }
    if (this.goodsList != null) {
      data['goodsList'] = this.goodsList.map((v) => v.toJson()).toList();
    }
    data['limit'] = this.limit;
    data['page'] = this.page;
    return data;
  }
}

class Cannnel {
  int id;
  String name;
  String keywords;
  String desc;
  int pid;
  String iconUrl;
  String picUrl;
  String level;
  int sortOrder;
  String addTime;
  String updateTime;
  bool deleted;
  List<Category> category;

  Cannnel(
      {this.id,
      this.name,
      this.keywords,
      this.desc,
      this.pid,
      this.iconUrl,
      this.picUrl,
      this.level,
      this.sortOrder,
      this.addTime,
      this.updateTime,
      this.deleted,
      this.category});

  Cannnel.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    name = json['name'];
    keywords = json['keywords'];
    desc = json['desc'];
    pid = json['pid'];
    iconUrl = json['iconUrl'];
    picUrl = json['picUrl'];
    level = json['level'];
    sortOrder = json['sortOrder'];
    addTime = json['addTime'];
    updateTime = json['updateTime'];
    deleted = json['deleted'];
    if (json['category'] != null) {
      category = new List<Category>();
      json['category'].forEach((v) {
        category.add(new Category.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['name'] = this.name;
    data['keywords'] = this.keywords;
    data['desc'] = this.desc;
    data['pid'] = this.pid;
    data['iconUrl'] = this.iconUrl;
    data['picUrl'] = this.picUrl;
    data['level'] = this.level;
    data['sortOrder'] = this.sortOrder;
    data['addTime'] = this.addTime;
    data['updateTime'] = this.updateTime;
    data['deleted'] = this.deleted;
    if (this.category != null) {
      data['category'] = this.category.map((v) => v.toJson()).toList();
    }
    return data;
  }
}



